Imports ccapps.persistent.Siemens_SCP_TekMsisdn
Imports ccapps.Util

Namespace Web.page

    Public Class Siemens_SCP_TekMsisdn
        Inherits [lib].BasePage

        Protected WithEvents DefProf As System.Web.UI.HtmlControls.HtmlSelect
        Protected WithEvents custcode As System.Web.UI.WebControls.TextBox
        Protected WithEvents txt_old_WHITE_LIST As System.Web.UI.WebControls.TextBox
        Protected WithEvents txt_new_SHORT_NUMBER As System.Web.UI.WebControls.TextBox
        Protected WithEvents txt_new_WHITE_LIST As System.Web.UI.WebControls.TextBox
        Protected WithEvents pnl_MSISDN_SEC As System.Web.UI.WebControls.Panel
        Protected WithEvents pnl_Islem As System.Web.UI.WebControls.Panel
        Protected WithEvents lbl_VPNNAME As System.Web.UI.WebControls.Label
        Protected WithEvents txt_MSISDN As System.Web.UI.WebControls.TextBox
        Protected WithEvents cb_VpnTanimli As System.Web.UI.WebControls.CheckBox
        Protected WithEvents lbl_New_VPNID As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_New_MSISDN As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_New_MemberType As System.Web.UI.WebControls.Label
        Protected WithEvents ddl_New_PROFILE As System.Web.UI.WebControls.DropDownList
        Protected WithEvents btn_Find As System.Web.UI.WebControls.Button
        Protected WithEvents lbl_WhitelistWarning As System.Web.UI.WebControls.Label
        Protected WithEvents btn_PrepareFile As System.Web.UI.WebControls.Button
        Protected WithEvents lbl_Custcode As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_Customer_id As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_Coid As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_CustomerData As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_old_Status As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_old_VPNID As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_old_MSISDN As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_old_short_number As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_old_profile As System.Web.UI.WebControls.Label
        Protected WithEvents lbl_old_member_type As System.Web.UI.WebControls.Label
        Dim ayyil As String

#Region " Web Form Designer Generated Code "

        'This call is required by the Web Form Designer.
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        End Sub
        Protected WithEvents ltlAlert As System.Web.UI.WebControls.Literal
        Protected WithEvents Button66 As System.Web.UI.WebControls.Button
        Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
        Protected WithEvents proc As System.Web.UI.HtmlControls.HtmlInputHidden
        'Protected WithEvents Button1 As System.Web.UI.HtmlControls.HtmlInputButton

        'NOTE: The following placeholder declaration is required by the Web Form Designer.
        'Do not delete or move it.
        Private designerPlaceholderDeclaration As System.Object

        Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeComponent()
        End Sub

#End Region

        'Private g_ddl_PROFILE As New System.Web.UI.WebControls.DropDownList
        'Private g_ddl_MEMBER_TYPE As New System.Web.UI.WebControls.DropDownList

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
            Me.PageTitle = "Siemens SCP Single MSISDN Definitions"
            Me.HelpDocName = ""
            Message = Session("SSCP_TEKMSISDN_Message")
            Session("SSCP_TEKMSISDN_Message") = ""

            Dim Vproc As String
            Vproc = Me.proc.Value
            Me.proc.Value = ""
            Select Case Vproc
                Case "BtnHndl_ChangeMSISDN"
                    BtnHndl_ChangeMSISDN()
                    ' link("Change MSISDN","BtnHndl_ChangeMSISDN")
            End Select

            If Session("SSCP_TEKMSISDN_MSISDN") = "" Then
                pnl_MSISDN_SEC.Visible = True
                pnl_Islem.Visible = False
            Else
                pnl_MSISDN_SEC.Visible = False
                pnl_Islem.Visible = True
                If Request("btn_PrepareFile") <> "Save & Prepare File" Then
                    VarolanDoldur()
                End If
            End If
        End Sub

        Private Sub btn_Find_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Find.Click
            Session("SSCP_TEKMSISDN_MSISDN") = txt_MSISDN.Text
            Response.Redirect("Siemens_SCP_TekMsisdn.aspx")
        End Sub

        Private Sub BtnHndl_ChangeMSISDN()
            Session("SSCP_TEKMSISDN_MSISDN") = ""
            Response.Redirect("Siemens_SCP_TekMsisdn.aspx")
        End Sub
        Private Sub VarolanDoldur()
            Dim l_VPNID As String
            Dim l_ShortNumber As String
            Dim l_PROFILE As String
            Dim l_MemberType As String
            Dim l_WhiteList As String
            Dim l_custcode As String
            Dim l_Customer_id As String
            Dim l_Co_id As String
            Dim l_Customer_Data As String
            Dim l_Status As String
            Dim l_VPNName As String
            Dim l_sonuc As String
            l_sonuc = VarolanBilgileriGetir(CStr(Session("SSCP_TEKMSISDN_MSISDN")), l_VPNID, l_ShortNumber, l_PROFILE, l_MemberType, l_WhiteList, l_custcode, l_Customer_id, l_Co_id, l_Customer_Data, l_Status, l_VPNName)
            If l_sonuc <> "OK" Then
                Session("SSCP_TEKMSISDN_Message") = "alert('" + l_sonuc + "');"
                Session("SSCP_TEKMSISDN_MSISDN") = ""
                Response.Redirect("Siemens_SCP_TekMsisdn.aspx")
            End If
            lbl_old_member_type.Text = l_MemberType
            lbl_old_VPNID.Text = l_VPNID
            lbl_old_short_number.Text = l_ShortNumber
            lbl_old_profile.Text = l_PROFILE
            txt_old_WHITE_LIST.Text = l_WhiteList
            lbl_Custcode.Text = l_custcode
            lbl_Customer_id.Text = l_Customer_id
            lbl_Coid.Text = l_Co_id
            lbl_CustomerData.Text = l_Customer_Data
            lbl_old_Status.Text = l_Status
            lbl_VPNNAME.Text = l_VPNName
            lbl_old_MSISDN.Text = CStr(Session("SSCP_TEKMSISDN_MSISDN"))
            lbl_New_VPNID.Text = l_VPNID
            lbl_New_MSISDN.Text = CStr(Session("SSCP_TEKMSISDN_MSISDN"))

            If l_MemberType = "1" Then
                l_MemberType = "GSM"
            ElseIf l_MemberType = "4" Then
                l_MemberType = "Partner"
            ElseIf l_MemberType = "5" Then
                l_MemberType = "PBX"
            End If
            lbl_old_member_type.Text = l_MemberType
            lbl_New_MemberType.Text = l_MemberType

            ddl_New_PROFILE.Items.Clear()
            Dim dummy_ddl = TumProfiller()
            Dim i As Integer = 0
            While i < dummy_ddl.Items.Count
                Dim l_li As New System.Web.UI.WebControls.ListItem
                l_li.Text = dummy_ddl.Items(i).Text
                l_li.Value = dummy_ddl.Items(i).Value
                ddl_New_PROFILE.Items.Add(l_li)
                i += 1
            End While
            'Yeni data'lar girilirken eskiler default gelsin.
            ddl_New_PROFILE.SelectedValue = l_PROFILE
            lbl_old_short_number.Text = l_ShortNumber
            txt_new_WHITE_LIST.Text = l_WhiteList

        End Sub

        Private Sub btn_PrepareFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_PrepareFile.Click
            Dim l_sonuc As String
            Save_and_Preparefile("a", lbl_New_VPNID.Text, lbl_New_MSISDN.Text, txt_new_SHORT_NUMBER.Text, ddl_New_PROFILE.SelectedValue, lbl_New_MemberType.Text, txt_new_WHITE_LIST.Text, Session("user"), "Y", l_sonuc)
            If l_sonuc <> "OK" Then
                Session("SSCP_TEKMSISDN_Message") = "alert('" + l_sonuc + "');"
                Session("SSCP_TEKMSISDN_MSISDN") = ""
                Response.Redirect("Siemens_SCP_TekMsisdn.aspx")
            Else
                Session("SSCP_TEKMSISDN_Message") = "alert('Saved and file prepared.');"
                Response.Redirect("Siemens_SCP_TekMsisdn.aspx")
            End If
        End Sub
    End Class
End Namespace